<script setup>
import {ref} from 'vue'

const topicItem = ref([
  {
    id: 1,
    topicMain: '吃这些美食才不算辜负自己',
    topicSub: '餐厨起居洗护好物',
    price: 29.9,
    favorite: 1200,
    view: 1800,
    message: 246,
    img: require('@/assets/images/goods1.png')
  },
  {
    id: 2,
    topicMain: '吃这些美食才不算辜负自己',
    topicSub: '餐厨起居洗护好物',
    price: 29.9,
    favorite: 1200,
    view: 1800,
    message: 246,
    img: require('@/assets/images/topic2.png')
  },
  {
    id: 3,
    topicMain: '吃这些美食才不算辜负自己',
    topicSub: '餐厨起居洗护好物',
    price: 29.9,
    favorite: 1200,
    view: 1800,
    message: 246,
    img: require('@/assets/images/topic3.png')
  }
])

</script>

<template>
  <li class="base-topic-item" v-for="item in topicItem" :key="item.id">
    <a href="#">
      <div class="pic">
        <img :src="item.img" alt=""/>
        <div class="info">
          <div class="left">
            <h5>{{ item.topicMain }}</h5>
            <p>{{ item.topicSub }}</p>
          </div>
          <div class="right">¥<span>{{ item.price }}</span>起</div>
        </div>
      </div>
      <div class="txt">
        <div class="left">
          <p>
            <span class="iconfont icon-favorites-fill red"></span>
            <i>{{ item.favorite }}</i>
          </p>
          <p>
            <span class="iconfont icon-browse"></span>
            <i>{{ item.view }}</i>
          </p>
        </div>
        <div class="right">
          <span class="iconfont icon-comment"></span>
          <i>{{ item.message }}</i>
        </div>
      </div>
    </a>
  </li>
</template>

<style scoped>
.base-topic-item li {
  width: 405px;
  height: 355px;
}

.base-topic-item .pic {
  position: relative;
  width: 405px;
  height: 288px;
}

.base-topic-item .txt {
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  height: 67px;
  line-height: 67px;
  color: #666;
  font-size: 14px;
}

.base-topic-item .txt .left {
  display: flex;
}

.base-topic-item .txt .left p {
  margin-right: 20px;
}

.base-topic-item .txt .left .red {
  color: #AA2113;
}

.base-topic-item .info {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  width: 100%;
  height: 90px;
  background-image: linear-gradient(180deg, rgba(137, 137, 137, 0.00) 0%, rgba(0, 0, 0, 0.90) 100%);
}

.base-topic-item .info .left {
  padding-top: 20px;
  color: #fff;
}

.base-topic-item .info .left h5 {
  margin-bottom: 5px;
  font-size: 20px;
}

.base-topic-item .info .right {
  margin-top: 35px;
  padding: 0 7px;
  height: 25px;
  line-height: 25px;
  background-color: #fff;
  color: #AA2113;
  font-size: 15px;
}
</style>